package com.iwhalecloud.citybrain.flow.platform.manager.domain.enums;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 通知类型
 *
 * @author wuliepeng
 * @date 2019-07-11
 */
public enum NoticeTypeEnum {

    /**
     *
     */
    PROCESS_TIMEOUT_NOTICE("PROCESS_TIMEOUT", "流程超时通知"),

    PROCESS_WARNING_NOTICE("PROCESS_WARNING", "流程预警通知"),

    TASK_TIMEOUT_NOTICE("TASK_TIMEOUT", "任务超时通知"),

    TASK_WARNING_NOTICE("TASK_WARNING", "任务预警通知"),

    TASK_START_NOTICE("TASK_START", "任务开始通知"),
    TASK_COMPLETED_NOTICE("TASK_COMPLETED", "任务完成通知"),
    TASK_CLAIM_NOTICE("TASK_CLAIM", "任务签收通知"),
    TASK_DEPLAY_NOTICE("TASK_DEPLAY", "任务延期通知"),
    TASK_ADDSIGNTASK_NOTICE("TASK_ADDSIGNTASK", "任务加签通知"),
    TASK_TRUN_NOTICE("TASK_TRUN", "任务转办通知"),
    TASK_REMIND("TASK_REMIND", "任务催办通知"),
    PROCESS_INSTANCE_RECALL("PROCESS_INSTANCE_RECALL", "任务撤回通知");

    private String code;

    private String description;

    private static Map<String, String> codeToDesc = new HashMap<>();

    static {
        Arrays.asList(values()).forEach(item -> codeToDesc.put(item.getCode(), item.getDescription()));
    }

    NoticeTypeEnum(String code, String description) {
        this.code = code;
        this.description = description;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public static String getDescrByCode(String code) {
        return codeToDesc.get(code);
    }

    public static Map<String, String> getCodeToDesc() {
        return codeToDesc;
    }

    public static void setCodeToDesc(Map<String, String> codeToDesc) {
        NoticeTypeEnum.codeToDesc = codeToDesc;
    }
}
